In [4]:
import numpy as np
import matplotlib.pyplot as plt
import itertools
import math
from decimal import Decimal, getcontext
In [6]:
# https://matplotlib.org/stable/gallery/color/color_cycle_default.html
prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
In [2]:
X = np.array([1, -1, 0])
Y = np.array([0,  0, 1])
In [19]:
def plot_for(q1, q3, q1_label, q3_label):
    getcontext().prec = 100

    points = [Decimal(i) / Decimal(100) for i in range(101)]
    fig, ax = plt.subplots(dpi=300)
    increases_x = []
    increases_y = []
    # Really, non-increasing
    decreases_x = []
    decreases_y = []
    for z2 in points:
        for z3 in points:
            if z2 + z3 > 1:
                continue
            if q3 * z3 + q3 * z2 + q1 * z3 > q3:
                increases_x.append(z2)
                increases_y.append(z3)
            else:
                decreases_x.append(z2)
                decreases_y.append(z3)
    ax.plot(increases_x, increases_y, "o", markersize=2, label="Points where q3 increases")
    ax.plot(decreases_x, decreases_y, "o", markersize=2, label="Points where q3 doesn't increase")

    ax.set_xlabel("z2")
    ax.set_ylabel("z3")
    ax.set_title(f"Values of z2 and z3 where q1 = {q1_label}, q3 = {q3_label}, such that q3 is not weakly decreasing")
    ax.legend()
    fig.show(warn=False)
plot_for(Decimal(".1"), Decimal(".01"), ".1", ".01")
plot_for(Decimal(".1"), Decimal(".05"), ".1", ".05")
plot_for(Decimal(".1"), Decimal(".1"), ".1", ".1")
plot_for(Decimal(".01"), Decimal(".01"), ".01", ".01")
plot_for(Decimal(".01"), Decimal(".05"), ".01", ".05")
plot_for(Decimal(".01"), Decimal(".1"), ".01", ".1")